<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <div id="app">
        <ul>
            <li v-for="item in goods">
                <input type="checkbox" v-model="select" :value="item.goodsName">
                <b>{{item.goodsName}}</b>
            </li>
        </ul>
        <h1>{{select}}</h1>
    </div>
</body>

</html>
<script src='https://cdn.jsdelivr.net/npm/vue@2.6.14/dist/vue.js'></script>
<script>
    //语法:v-model用在列表中的时候,model的表达式的值必须是一个数组,结合value属性,可以完成批量的数据绑定

    //被勾选之后,可获取value绑定的值
    let vm = new Vue({
        el: "#app",
        data: {
            select:[],
            goods: [
                {
                    id: 1,
                    goodsName: "滑板鞋",
                    price: 18
                },
                {
                    id: 2,
                    goodsName: "品如的衣柜",
                    price: 20
                },
                {
                    id: 3,
                    goodsName: "贾克斯的灯",
                    price: 25
                },
            ]
        }
    })
</script>